function afBaricenters = ComputeBaricenters( afOriginalElements )
	%
	% storage allocation
	afBaricenters = zeros(size(afOriginalElements));
	%
	% find the non null elements
	abNonNullElements = ( afOriginalElements ~= 0 );
	%
	% find the transition indexes
	afDiffOfNonNullElements 					= [ diff( abNonNullElements ) ; 0 ];
	abWhereOneStartsPeriodsOfNonNullElements	= [ afDiffOfNonNullElements > 0 ];
	abWhereOneExitsPeriodsOfNonNullElements		= [ afDiffOfNonNullElements < 0 ];
	%
	% if there is something strange then return
	if(		numel( find(abWhereOneStartsPeriodsOfNonNullElements) )	...
		~=	numel( find(abWhereOneExitsPeriodsOfNonNullElements) )	)
		%
		return;
		%
	end;%
	%
	% construct a matrix N_periods x 2 with the starting / ending indexes
	aaiIndexesOfInterestingPeriods	=								...
		[															...
			find( abWhereOneStartsPeriodsOfNonNullElements ) + 1,	...
			find( abWhereOneExitsPeriodsOfNonNullElements ) + 1	...
		];
	%
	% if there is no starting / ending indexes then return
	if( numel(aaiIndexesOfInterestingPeriods) <= 1 )
		%
		return;
		%
	end;%
	%
	% for each period compute the baricenter
	for iPeriod = 1:numel( aaiIndexesOfInterestingPeriods(:, 1) );
		%
		% for readability
		iStartIndex	= aaiIndexesOfInterestingPeriods(iPeriod, 1);
		iEndIndex	= aaiIndexesOfInterestingPeriods(iPeriod, 2);
		%
		% compute the index of the baricenter
		iBaricenterIndex = round( (iStartIndex + iEndIndex) / 2 );
		%
		% compute the amplitude of the baricenter
		fBaricenterValue = sum( afOriginalElements(iStartIndex:iEndIndex) );
		%
		% set the output
		afBaricenters(iBaricenterIndex) = fBaricenterValue;
		%
	end;%
	%
	%
	% DEBUG
% 	figure(1)
% 	hold on;
% 	plot(afOriginalElements, 'r');
% 	plot(afBaricenters, 'k');
% 	hold off;
% 	pause
	%
end % function

